<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加角色</title>
    <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/static/admin/css/animate.css" rel="stylesheet">
    <link href="/static/admin/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加角色</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" action="{:url('Role/add')}" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">角色名称</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="title">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">状态</label>

                            <div class="col-sm-10">
                                <label class="radio-inline i-checks">
                                    <input type="radio" name="status" value="1" checked>是</label>
                                <label class="radio-inline i-checks">
                                    <input type="radio" name="status" value="0">否</label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">权限</label>

                            <div class="col-sm-10">
                                <div class="table-responsive" style="overflow-x: visible;">
                                    <table class="table table-bordered table-hover">
                                        <tbody>
                                        <tr>
                                            <th style="width: 100px;">
                                                <div class="checkbox">
                                                    <label class="checkbox-inline">
                                                        <input onchange="checkAll()" type="checkbox"
                                                               value="">
                                                        全选
                                                    </label>
                                                </div>
                                            </th>
                                            <th>权限标题</th>
                                        </tr>
                                        {foreach $all_permissions as $v}
                                        <tr>
                                            <td>
                                                <div class="checkbox">
                                                    <label>
                                                        <input type="checkbox" name="rules[]" class="check" value="{$v.id}">
                                                    </label>
                                                </div>
                                            </td>
                                            <td>{:html_entity_decode($v.title)}</td>
                                        </tr>
                                        {/foreach}
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存</button>
                                <button class="btn btn-white" type="button" onclick="history.go(-1)">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="/static/admin/js/content.js?v=1.0.0"></script>

<!-- iCheck -->
<script src="/static/admin/js/plugins/iCheck/icheck.min.js"></script>

<script>
    function checkAll() {
        //Enable check and uncheck all functionality
        $("table .check").prop("checked", function (index, oldValue) {
            return !oldValue;
        });
    }

    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    });
</script>


</body>

</html>
